package com.example.test_aidl;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author Ohuang
 */
public class User implements Parcelable {
    private int id;
    private String name;
    private String msg;
    private byte[] bytes;


    public User() {
    }



    public User(int id, String name, String msg) {
        this.id = id;
        this.name = name;
        this.msg = msg;
    }

    public byte[] getBytes() {
        return bytes;
    }

    public void setBytes(byte[] bytes) {
        this.bytes = bytes;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", msg='" + msg + '\'' +
                '}';
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.name);
        dest.writeString(this.msg);
        dest.writeByteArray(this.bytes);
    }

    public void readFromParcel(Parcel source) {
        this.id = source.readInt();
        this.name = source.readString();
        this.msg = source.readString();
        this.bytes = source.createByteArray();
    }

    protected User(Parcel in) {
        this.id = in.readInt();
        this.name = in.readString();
        this.msg = in.readString();
        this.bytes = in.createByteArray();
    }

    public static final Creator<User> CREATOR = new Creator<User>() {
        @Override
        public User createFromParcel(Parcel source) {
            return new User(source);
        }

        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };


}
